﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Web.UI;
using TA.Win.Utils.Design;
using System.Drawing.Design;

namespace TA.Turbo.Controls
{
	/// <summary>
	/// Base class for controls which allow for value input.
	/// </summary>
	public abstract class BaseValueControl : BaseValueDisplayControl
	{

		#region PUBLIC
		#region INIT
		#endregion
		#region EVENTS
		/// <summary>
		/// Raised when value changed.
		/// </summary>
		[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
		[PersistenceMode(PersistenceMode.InnerProperty)]
		[Editor(typeof(PropertyEditor), typeof(UITypeEditor))]
		[Category("Events")]
		public ServerEvent<EventArgs> ValueChanged
		{
			get
			{
				return this.GetServerEvent<EventArgs>("ValueChanged");
				//if (this._valueChanged == null)
				//{
				//  this._valueChanged = new ServerEvent<EventArgs>(this, "ValueChanged", new ControlTransferOptions
				//  {
				//    Value = true,
				//  }, new ControlTransferOptions { });
				//}
				//return this._valueChanged;
			}
		}
		#endregion
		#region PROPS
		#endregion
		#region METHODS
		#endregion
		#endregion
		#region INTERNAL
		#region CONST/STATIC
		#endregion
		#region VARS
		#endregion
		#region PROPS
		#endregion
		#region METHODS
		#region INIT
		/// <summary>
		/// Saves the state of this control for being reset when re-using the page.
		/// </summary>
		protected internal override void SaveForReset()
		{
			base.SaveForReset();

			this.SaveValueForReset();
		}
		/// <summary>
		/// Resets the state of this control to the saved version when re-using the page.
		/// </summary>
		protected internal override void Reset()
		{
			base.Reset();

			this.ResetValue();
		}
		/// <summary>
		/// Saves the value of this control for being reset when re-using the page.
		/// </summary>
		protected abstract void SaveValueForReset();
		/// <summary>
		/// Resets the value of this control to the saved version when re-using the page.
		/// </summary>
		protected abstract void ResetValue();
		#endregion
		#region DATA
		#endregion
		#region HANDLERS
		#endregion
		#endregion
		#endregion

	}
}
